home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Precision Software Appli…tions Silver Collection 1
/
Precision Software Applications Silver Collection Volume One (PSM) (1993).iso
/
tutor
/
modula12.exe
/
PROCTYPE.MOD
< prev
next >
Wrap
Text File
|
1988-10-26
|
1KB
|
44 lines
(* Chapter 13 - Program 5 *)
MODULE ProcType;
FROM InOut IMPORT WriteString, WriteLn;
VAR OutputStuff : PROCEDURE(ARRAY OF CHAR);
VarLine : ARRAY[0..50] OF CHAR;
PROCEDURE WriteWithNote(InString : ARRAY OF CHAR);
BEGIN
WriteString("Written with a note ---> ");
WriteString(InString);
WriteLn;
END WriteWithNote;
PROCEDURE WriteWithComment(InputLine : ARRAY OF CHAR);
BEGIN
WriteString(InputLine);
WriteString(" <--- Written with a comment");
WriteLn;
END WriteWithComment;
BEGIN
VarLine := "This is a line of data.";
(* This uses WriteWithNote *)
OutputStuff := WriteWithNote;
OutputStuff(VarLine);
OutputStuff("Extra output ");
(* This uses WiteWithComment *)
OutputStuff := WriteWithComment;
OutputStuff(VarLine);
(* This uses WriteString *)
OutputStuff := WriteString;
OutputStuff(VarLine);
OutputStuff(" End of the line");
WriteLn;
(* The Procedures can be used in normal fashion too *)
WriteLn;
WriteWithNote("This is straight output.");
WriteWithComment("This too is straight output.");
WriteString(VarLine);
END ProcType.